import { ref } from 'vue';

const eventBus = ref({
    on(event, callback) {
        if (!this[event]) {
            this[event] = [];
        }
        this[event].push(callback);
    },
    emit(event, data) {
        if (this[event]) {
            this[event].forEach(callback => callback(data));
        }
    }
});

export default eventBus;